﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyTestPage.aspx.cs" Inherits="MyTestPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
   <input type="button" onclick="ShowTime()" value="click" />
      <input type="button" onclick="f_GetAstro(03-01)" value="click" />
    </div>
     <script type ="text/javascript">
         function ShowTime(d) {

             var dd = new Date(d);

             var newd = new Date(Date.parse(dd.replace(/-/g, "/")));
             alert(newd);
             var t = document.getElementById("TextBox1");
             //             alert(d.getDate().toString().substr(1, 1));
             var strDate = "2012-03-01";
             var newDate = new Date(Date.parse(strDate.replace(/-/g, "/")));
             //alert(strDate.toString());

             t.value = dd.toString();
//             if (Convert.ToDateTime("0000/12/22".Substring(5, 5)) <= Convert.ToDateTime((this.txtBrithDay.Value).Substring(5, 5)) || Convert.ToDateTime("3999/01/19".Substring(5, 5)) >= Convert.ToDateTime((this.txtBrithDay.Value).Substring(5, 5))) {
//                 txt_Constellation.Text = "魔羯座"; //    (12/22 - 1/19)    Capricorn
//             }

             if (newDate.toString() > newd.toString())
             {
                 alert(strDate.toString().substr(5,5));
             }
         }
    </script>

    <script language="javaScript">
        function f_GetAnimal(ld_year) {
            var la_Animals = new Array("鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪");
            return la_Animals[(ld_year - 4) % 12];
        }
        function f_GetAstro(ld_month, ld_day) {
            var s = "魔羯水瓶双鱼牧羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯", arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22];
            return s.substr(ld_month * 2 - (ld_day < arr[ld_month - 1] ? 2 : 0), 2);
        }
        function Start(tp) {
            var birth = document.getElementById("birth");
            if (!/\d{4}([\-\/]\d{1,2}){2}/.test(birth.value)) { alert('请输入正确的数据！'); birth.select(); return false; }
            var arr = birth.value.split(/[\-\/]/);
            alert('生肖：' + f_GetAnimal(parseInt(arr[0], 10)) + '\n星座：' + f_GetAstro(parseInt(arr[1], 10), parseInt(arr[2], 10)));
        }
   </script>   

    </form>
</body>
</html>
